﻿using SharpArch.Core.DomainModel;
using SharpArch.Core.PersistenceSupport;
using NHibernate.Validator.Constraints;
using SharpArch.Core;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.Collections.Generic;

namespace zeus.Core
{
    public class Poligono : Entity
    {
        public Poligono()
        {
            Detalles = new List<PoligonoDetalle>();
        }

        public virtual string Nombre { get; set; }

        public virtual int CodigoUnidad { get; set; }

        public virtual int Tipo { get; set; }

        public virtual int Zoom { get; set; }

        public virtual decimal LatCenter { get; set; }

        public virtual decimal LngCenter { get; set; }

        public virtual Unidad Unidad { get; set; }

        public virtual string UsuarioCreacion { get; set; }

        public virtual IList<PoligonoDetalle> Detalles { get; set; }

        public virtual void AddDetalle(PoligonoDetalle poligonoDetalle)
        {
            if (poligonoDetalle.Poligono != null)
                poligonoDetalle.Poligono.Detalles.Remove(poligonoDetalle);

            poligonoDetalle.Poligono = this;
            Detalles.Add(poligonoDetalle);
        }
    }
}
